<?php

namespace app\beautiful\model\partner;

use app\beautiful\model\member\MemberModel;
use app\common\model\CommonModel;

class MemberConsumeBonusModel extends CommonModel{

    protected  $name = 'beautiful_member_consume_bonus';

    protected  $pk   = 'member_consume_bonus_id';
    
    public static function onBeforeInsert($model)
    {
        $model->set("add_time", date('Y-m-d H:i:s'));
        $model->set("add_ip", request()->ip());
    }

    public function member(){
        return $this->hasOne(MemberModel::class,'member_id','member_id');
    }

}

